<div class="module files">
    <h3 class="gradient dark">
	<?
		if(!$group_id || ($group_id && EntitlementPeer::isEntitled($group_id, $user->getId(),EntitlementPeer::GROUP_TYPE,
								EntitlementPeer::WRITE_PERMISSION))) :
	?>
		<a id="upload-lnk" href="javascript:void(0)">Upload a File</a>
	<? endif; ?>
	<?php echo $phrase ?> Files
    </h3>
     <form class="file-upload" id="upload-form" enctype='multipart/form-data' action="" method="post">
	<fieldset>
	    <h4>Upload a File</h4>
	    
	    <div class="left-border">
     <label>1. Choose a file:</label>
		<input type="file" id="upload-file-select" name="Filedata"/>

		<label>2. Describe this file:</label>
		<input type="text" id="upload-file-desc" name="desc"/>

		<label>3. List tags for this file:</label>
		<input type="text" name="tags"/>
		<input type="hidden" name="fmt" value="redir"/>
		<input id="loc" type="hidden" name="loc" value="<? 
			$url = url_for('files/add', true) . "?access=every"; 
			if($group_id) $url = $url ."&group=".$group_id; 
			echo $url; ?>"/>
		<input id="errloc"  type="hidden" name="errloc" value="<? 
			$url = url_for('files/add', true) . "?access=every"; 
			if($group_id) $url = $url ."&group=".$group_id; 
			echo $url; ?>"/>
		
		<label>4. Who can see this file (Permission):</label>
		<select id="permit" name="permit" size="1">
		<?php if($group_id && EntitlementPeer::isEntitled($group_id, $user->getId(),EntitlementPeer::GROUP_TYPE,
								EntitlementPeer::WRITE_PERMISSION)) : ?>
			<option value="1" selected="yes">Group</option>
			<option value="2">Network</option>
		<?php else : ?>
		    <option value="0" selected="yes">Private</option>
		    <option value="4">Everyone</option>
		    <option value="2">Network</option>
		<?php endif; ?>
		</select>
	    </div>
	    <input type="button" id="upload-submit" value="Upload" />
     or <a id="upload-cancel" href="javascript:void(0)">Cancel</a>&nbsp;&nbsp;
	    <img id="loader-gif" src="/images/ajax-loader_small.gif" border="0" style="display:none; vertical-align: middle;"/>
	</fieldset>
    </form>
    
    <div class="inner" id="files-list">
     <?php include_partial('files/innerlist', array('user' => $user, 'groupid' => $group_id, 'documents' => $documents, 'annotate_base_url' => $annotate_base_url));?>
    </div>
</div>
